diff --git a/django/db/models/base.py b/django/db/models/base.py
index a2f594041e..356bc17d84 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -1100,9 +1100,9 @@ class Model(metaclass=ModelBase):
                         "related object '%s'." % (operation_name, field.name)
                     )
                 elif getattr(self, field.attname) in field.empty_values:
-                    # Use pk from related object if it has been saved after
+                    # Use object from related field if it has been saved after
                     # an assignment.
-                    setattr(self, field.attname, obj.pk)
+                    setattr(self, field.name, obj)
                 # If the relationship's pk/to_field was changed, clear the
                 # cached relationship.
                 if getattr(obj, field.target_field.attname) != getattr(
